﻿using System;
using System.Collections;

namespace Kenly.DBFramework.Gateway
{
    /// <summary>
    /// 
    /// </summary>
    public interface IViewGateway
    {
        /// <summary>
        /// 
        /// </summary>
        object EntityId
        {
            get;
            set;
        }

        /// <summary>
        /// 
        /// </summary>
        object PrimaryKey
        {
            get;
            set;
        }

        /// <summary>
        /// Determines whether the entity exists with the specified identity.
        /// </summary>
        /// <returns></returns>
        bool ExistsById();

        /// <summary>
        /// Determines whether the entity exists with the specified primary key.
        /// </summary>
        /// <returns></returns>
        bool ExistsByPK();

        /// <summary>
        /// Retrieves all association entities.
        /// </summary>
        /// <returns></returns>
        ArrayList RetrieveAssociations();

        /// <summary>
        /// Retrieves the association entities which are of the specified types.
        /// </summary>
        /// <param name="elementTypes">The types of association entityies</param>
        /// <returns></returns>
        ArrayList RetrieveAssociations(params Type[] elementTypes);

        /// <summary>
        /// Retrieves the association entity which is of the specified type.
        /// </summary>
        /// <param name="elementType">The type of association entity</param>
        /// <returns></returns>
        ArrayList RetrieveAssociations(Type elementType);

        /// <summary>
        /// Retrieves the entity from database table by identity.
        /// </summary>
        void RetrieveById();

        /// <summary>
        /// Retrieves the entity from database table by primary key.
        /// </summary>
        void RetrieveByPK();

        /// <summary>
        /// Copies the column property values from source to target.
        /// </summary>
        /// <param name="targetEntity"></param>
        void ShadowCopyTo(object targetEntity);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="config"></param>
        void RefreshConfig(GatewayConfig config);
    }
}
